package com.chenshu;

import com.chenshu.beans.ByName;
import com.chenshu.beans.ByType;
import com.chenshu.beans.User;
import com.chenshu.controller.UserController;
import com.chenshu.dao.DemoDao;
import com.chenshu.service.UserService;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2024-03-28
 * Time：12:41
 */
public class Application {
    public static void main(String[] args) {
        BeanFactory factory = new ClassPathXmlApplicationContext("spring-conf.xml");
//        ByName test1 = (ByName) factory.getBean("test1");
//        System.out.println(test1);
//
//        ByType byType = factory.getBean(ByType.class);
//        System.out.println(byType);
//
//        DemoDao demoDao = factory.getBean(DemoDao.class);
//        System.out.println(demoDao);

//        User user = (User) factory.getBean("user");
//        System.out.println(user);
//
//        UserService userService = factory.getBean(UserService.class);
//        System.out.println(userService.getDemoDao());
        UserController userController = factory.getBean("userController", UserController.class);
        userController.doController();
    }
}
